home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0020_NICEFADE.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  81 lines

  1. {
  2. CHRIS BEISEL
  3.  
  4. Hey Terje, here's some stuff to get you started on some ideas For the
  5. group.  I threw it together it 3 minutes, so it's not much, but the
  6. assembley code isn't bad... here it is:
  7. }
  8.  
  9. Program palette;
  10.  
  11. Uses
  12.   Crt;
  13.  
  14. Const
  15.   vga_segment = $0A000;
  16.   fade_Delay  = 20;
  17.  
  18. Var
  19.   lcv  : Integer;
  20.   temp : Char;
  21.  
  22. Procedure video_mode (mode : Byte); Assembler;
  23. Asm
  24.   mov  AH,00
  25.   mov  AL,mode
  26.   int  10h
  27. end;
  28.  
  29. Procedure set_color (color, red, green, blue : Byte);
  30. begin
  31.   port[$3C8] := color;
  32.   port[$3C9] := red;
  33.   port[$3C9] := green;
  34.   port[$3C9] := blue;
  35. end;
  36.  
  37. Procedure wait_4_refresh; Assembler;
  38. Label
  39.   wait, retr;
  40. Asm
  41.   mov  DX,3DAh
  42.  wait:  in   AL,DX
  43.   test AL,08h
  44.   jz   wait
  45.  retr:  in   AL,DX
  46.   test AL,08h
  47.   jnz  retr
  48. end;
  49.  
  50. begin
  51.   ClrScr;
  52.   Writeln('Hey Terje, this is pretty cheezy, but it does show how to wait');
  53.   Writeln('for the vertical screen refresh in assembley, as well as how to');
  54.   Writeln('change colors, too... this isn''t the palette scrolling, but some');
  55.   Writeln('fade Type routines that may come in handy.  The video mode routine');
  56.   Writeln('was also written in assembley (obviously)... well, next I''m going');
  57.   Writeln('to work on zooming (It could be a cool effect).  C''ya L8r. ');
  58.   Writeln(' Press a key...');
  59.   temp := ReadKey;
  60.   video_mode($13);
  61.   lcv := 0;
  62.   Repeat
  63.     While lcv < 63 do
  64.     begin
  65.       wait_4_refresh;
  66.       set_color(0, lcv, lcv, lcv);
  67.       lcv := lcv + 1;
  68.       Delay(fade_Delay);
  69.     end;
  70.     While lcv > 0 do
  71.     begin
  72.       wait_4_refresh;
  73.       set_color(0, lcv, lcv, lcv);
  74.       lcv := lcv - 1;
  75.       Delay(fade_Delay);
  76.     end;
  77.   Until KeyPressed;
  78.   video_mode(3);
  79. end.
  80.  
  81.